package com.cskaoyan.service.vxaddress;

import com.cskaoyan.bean.MarketAddress;
import com.cskaoyan.bean.MarketAddressExample;
import com.cskaoyan.bean.vxaddressvo.VXAddressListVO;
import com.cskaoyan.mapper.MarketAddressMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * 创建日期: 2022/05/07 16:03
 *
 * @author shuyang
 */
@Service
public class VXAddressServiceImpl implements VXAddressService {
    @Autowired
    MarketAddressMapper addressMapper;
    static  Boolean isDefault;
    @Override
    public VXAddressListVO queryAddressListInVX() {
        MarketAddressExample marketAddressExample = new MarketAddressExample();
        MarketAddressExample.Criteria criteria = marketAddressExample.createCriteria();
        criteria.andDeletedEqualTo(false);
        List<MarketAddress> marketAddresses = addressMapper.selectByExample(marketAddressExample);
        return new VXAddressListVO(marketAddresses);
    }






    @Override
    public MarketAddress queryAddressByIdInVX(Integer id) {
        MarketAddress marketAddress = addressMapper.selectByPrimaryKey(id);
        return marketAddress;
    }







    @Override
    public void saveAddressInVX(MarketAddress marketAddress) {
     addressMapper.insertSelective(marketAddress);
    }

    @Override
    public void deleteAddressInVX(Integer id) {
        MarketAddress marketAddress = new MarketAddress();
        marketAddress.setDeleted(true);
        marketAddress.setId(id);
        addressMapper.updateByPrimaryKeySelective(marketAddress);
    }


}
